<?php
/**
 * @desc 小类公式列表管理
 * @author kevin wang
 * @date 2014-10-25
 */
class ctrl_formulalist extends ctrl_base {
    private static $dirName = 'formulalist';
    
    /**
     * @desc 商品列表
	 * @author kevin wang
	 * @param void
	 * @return void
     */
    public static function main() {
    	if(!model_admin::islogin()) {
    		self::goto_login();
    	}
		//self::operation(array('produce_small_class'));
		//页面输入参数处理
    	$currentPage = isset($_POST['pageNum']) ? $_POST['pageNum'] : 1;
    	$pagesize = isset($_POST['numPerPage']) ? $_POST['numPerPage'] : self::$_pagesize;
		$nextpage = ($currentPage - 1) * $pagesize;

    	$class_big_name = isset($_POST['class_big_name']) ? trim($_POST['class_big_name']) : '';
		$class_small_name = isset($_POST['class_small_name']) ? trim($_POST['class_small_name']) : '';
    	//搜索条件组合
		$condition = array();
    	if(!empty($class_big_name)) {
    		$condition['class_big_name'] = $class_big_name;
    	}
		if(!empty($class_small_name)) {
    		$condition['class_small_name'] = $class_small_name;
    	}
		//订单获取
    	$produce_list = model_formulalist :: get_formulalist_list($nextpage,$pagesize,$condition);
    	$total = array_pop($produce_list);
		//模板赋值
    	self::smarty() -> assign('produce_list', $produce_list);
		self::smarty() -> assign('total', $total);
		self::smarty() -> assign('pageNum', $currentPage);
		self::smarty() -> assign('numPerPage', $pagesize);
		self::smarty() -> assign('pageNumShown', self::$_pageNumShown);
		self::smarty() -> assign('class_big_name', $class_big_name);
		self::smarty() -> assign('class_small_name', $class_small_name);
		self::smarty() -> assign('shoNum', self::$_shoNum);
		
    	self::smarty() -> display(self::$dirName . '/formulalist_list.html');    	
    }
}
